memcached-pkg:
  pkg.installed:
    - names:
      - memcached

memcached-conf:
  file.managed:
    - name: /etc/sysconfig/memcached
    - source: salt://openstack/queen/memcached/files/memcached
    - user: root
    - group: root
    - mode: 644
    - template: jinja
    - defaults:
      MEMCACHED_IP: {{ pillar['memcached']['MEMCACHED_IP'] }}
    - require:
      - pkg: memcached-pkg

memcached-service:
  service.running:
    - name: memcached
    - enable: True
    - require:
      - file: memcached-conf
    - watch:
      - file: memcached-conf
